const baseUrl = 'http://web.woniulab.com:8005'

function request({ method = "GET", url, data }) {
    return new Promise((resolve, reject) => {
        let header = {
            Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcGVuaWQiOiJvT0dHczVLYk0zVVhFd0t6ZHdCalo5Z2tlNUdBIiwiX2lkIjoiNjEyZDkwN2Y1MWNhMmIxMjQ2YjNjMGEyIiwic2Vzc2lvbl9rZXkiOiJXN0NpaEZaMnhVMElPNVVqM2pTV0d3PT0iLCJpYXQiOjE2MzAzNzYxNzF9.md_FVvwuDpH3tMvFR_ruCzihk1qQBW6KdKg9Gm2Vg80"
          }
            
        //公共的传入header
        wx.request({
            url: baseUrl + url,//路径
            method,
            data,
            header,
            success(res) {
                //请求成功，就resolve出去
                // console.log(res, "**************");
                resolve(res.data)
            },
            fail(err) {
                //请求错误的时候
                reject(err)
            },
            complete() {
                //成功失败都会调用

            }
        })
    })
}

export default request